package com.bnq.control.desktop.xmlview;

import java.util.HashMap;
import java.util.Map;

import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;

import com.bnq.control.R;


public class KeyboardBaseView extends XmlView {

	static int[] key_id = { R.id.desktop_keyboard_q, R.id.desktop_keyboard_w,
			R.id.desktop_keyboard_e, R.id.desktop_keyboard_r,
			R.id.desktop_keyboard_t, R.id.desktop_keyboard_y,
			R.id.desktop_keyboard_u, R.id.desktop_keyboard_i,
			R.id.desktop_keyboard_o, R.id.desktop_keyboard_p,
			R.id.desktop_keyboard_a, R.id.desktop_keyboard_s,
			R.id.desktop_keyboard_d, R.id.desktop_keyboard_f,
			R.id.desktop_keyboard_g, R.id.desktop_keyboard_h,
			R.id.desktop_keyboard_j, R.id.desktop_keyboard_k,
			R.id.desktop_keyboard_l, R.id.desktop_keyboard_tab,
			R.id.desktop_keyboard_z, R.id.desktop_keyboard_x,
			R.id.desktop_keyboard_c, R.id.desktop_keyboard_v,
			R.id.desktop_keyboard_b, R.id.desktop_keyboard_n,
			R.id.desktop_keyboard_m, R.id.desktop_keyboard_del,
			R.id.desktop_keyboard_1, R.id.desktop_keyboard_2,
			R.id.desktop_keyboard_3, R.id.desktop_keyboard_4,
			R.id.desktop_keyboard_5, R.id.desktop_keyboard_6,
			R.id.desktop_keyboard_7, R.id.desktop_keyboard_8,
			R.id.desktop_keyboard_9, R.id.desktop_keyboard_0 };

	public KeyboardBaseView(View view) {
		super(view);
	}

	@Override
	protected void onInitClickView(View rootView, OnClickListener l) {
		super.onInitClickView(rootView, l);
		View v;
		for (int i = 0; i < key_id.length; i++) {
			v = rootView.findViewById(key_id[i]);
			v.setOnClickListener(l);
		}
	}

	public final static Map<Integer, String> mKey = new HashMap<Integer, String>() {
		/**
		 *
		 */
		private static final long serialVersionUID = 1L;

		{
			put(R.id.desktop_keyboard_q, "q");
			put(R.id.desktop_keyboard_w, "w");
			put(R.id.desktop_keyboard_e, "e");
			put(R.id.desktop_keyboard_r, "r");
			put(R.id.desktop_keyboard_t, "t");
			put(R.id.desktop_keyboard_y, "y");
			put(R.id.desktop_keyboard_u, "u");
			put(R.id.desktop_keyboard_i, "i");
			put(R.id.desktop_keyboard_o, "o");
			put(R.id.desktop_keyboard_p, "p");
			put(R.id.desktop_keyboard_a, "a");
			put(R.id.desktop_keyboard_s, "s");
			put(R.id.desktop_keyboard_d, "d");
			put(R.id.desktop_keyboard_f, "f");
			put(R.id.desktop_keyboard_g, "g");
			put(R.id.desktop_keyboard_h, "h");
			put(R.id.desktop_keyboard_j, "j");
			put(R.id.desktop_keyboard_k, "k");
			put(R.id.desktop_keyboard_l, "l");
			put(R.id.desktop_keyboard_tab, "TAB");
			put(R.id.desktop_keyboard_z, "z");
			put(R.id.desktop_keyboard_x, "x");
			put(R.id.desktop_keyboard_c, "c");
			put(R.id.desktop_keyboard_v, "v");
			put(R.id.desktop_keyboard_b, "b");
			put(R.id.desktop_keyboard_n, "n");
			put(R.id.desktop_keyboard_m, "m");
			put(R.id.desktop_keyboard_del, "DEL");
			put(R.id.desktop_keyboard_1, "1");
			put(R.id.desktop_keyboard_2, "2");
			put(R.id.desktop_keyboard_3, "3");
			put(R.id.desktop_keyboard_4, "4");
			put(R.id.desktop_keyboard_5, "5");
			put(R.id.desktop_keyboard_6, "6");
			put(R.id.desktop_keyboard_7, "7");
			put(R.id.desktop_keyboard_8, "8");
			put(R.id.desktop_keyboard_9, "9");
			put(R.id.desktop_keyboard_0, "0");
		}
	};

	public final static Map<Integer, Integer> mSSHKey = new HashMap<Integer, Integer>() {
		/**
		 *
		 */
		private static final long serialVersionUID = 1L;

		{
			put(R.id.desktop_keyboard_q, KeyEvent.KEYCODE_Q);
			put(R.id.desktop_keyboard_w, KeyEvent.KEYCODE_W);
			put(R.id.desktop_keyboard_e, KeyEvent.KEYCODE_E);
			put(R.id.desktop_keyboard_r, KeyEvent.KEYCODE_R);
			put(R.id.desktop_keyboard_t, KeyEvent.KEYCODE_T);
			put(R.id.desktop_keyboard_y, KeyEvent.KEYCODE_Y);
			put(R.id.desktop_keyboard_u, KeyEvent.KEYCODE_U);
			put(R.id.desktop_keyboard_i, KeyEvent.KEYCODE_I);
			put(R.id.desktop_keyboard_o, KeyEvent.KEYCODE_O);
			put(R.id.desktop_keyboard_p, KeyEvent.KEYCODE_P);
			put(R.id.desktop_keyboard_a, KeyEvent.KEYCODE_A);
			put(R.id.desktop_keyboard_s, KeyEvent.KEYCODE_S);
			put(R.id.desktop_keyboard_d, KeyEvent.KEYCODE_D);
			put(R.id.desktop_keyboard_f, KeyEvent.KEYCODE_F);
			put(R.id.desktop_keyboard_g, KeyEvent.KEYCODE_G);
			put(R.id.desktop_keyboard_h, KeyEvent.KEYCODE_H);
			put(R.id.desktop_keyboard_j, KeyEvent.KEYCODE_J);
			put(R.id.desktop_keyboard_k, KeyEvent.KEYCODE_K);
			put(R.id.desktop_keyboard_l, KeyEvent.KEYCODE_1);
			put(R.id.desktop_keyboard_tab, KeyEvent.KEYCODE_TAB);
			put(R.id.desktop_keyboard_z, KeyEvent.KEYCODE_Z);
			put(R.id.desktop_keyboard_x, KeyEvent.KEYCODE_X);
			put(R.id.desktop_keyboard_c, KeyEvent.KEYCODE_C);
			put(R.id.desktop_keyboard_v, KeyEvent.KEYCODE_V);
			put(R.id.desktop_keyboard_b, KeyEvent.KEYCODE_B);
			put(R.id.desktop_keyboard_n, KeyEvent.KEYCODE_N);
			put(R.id.desktop_keyboard_m, KeyEvent.KEYCODE_M);
			put(R.id.desktop_keyboard_del, KeyEvent.KEYCODE_DEL);
			put(R.id.desktop_keyboard_1, KeyEvent.KEYCODE_1);
			put(R.id.desktop_keyboard_2, KeyEvent.KEYCODE_2);
			put(R.id.desktop_keyboard_3, KeyEvent.KEYCODE_3);
			put(R.id.desktop_keyboard_4, KeyEvent.KEYCODE_4);
			put(R.id.desktop_keyboard_5, KeyEvent.KEYCODE_5);
			put(R.id.desktop_keyboard_6, KeyEvent.KEYCODE_6);
			put(R.id.desktop_keyboard_7, KeyEvent.KEYCODE_7);
			put(R.id.desktop_keyboard_8, KeyEvent.KEYCODE_8);
			put(R.id.desktop_keyboard_9, KeyEvent.KEYCODE_9);
			put(R.id.desktop_keyboard_0, KeyEvent.KEYCODE_0);
		}
	};
}
